<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script>
        function Person(name, age) {
            this.name = name
            this.age = age
        }
        const haha = new Person('haha', 18)
        Person.prototype.xixi = 'xixi'   //添加到原型上的方法
        console.log(Object.keys(haha));  //只获取对象自身的可枚举属性
        for (let key in haha) {
            // console.log(key);  //会遍历原型上面的属性
            if (haha.hasOwnProperty(key)) {
                console.log(key);   //进行一个过滤操作
            }
        }



    </script>
</body>

</html>